<?php
/**
 * Fastapp.
 * 1/11/25
 * @Author deepsea
 * @Contact telegram:deepsea159
 */


namespace App\Fastapp\Api\Controller\Cms;


use App\Fastapp\Api\Controller\ApiController;
use App\Fastapp\Api\Service\Cms\CategoryService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\GetMapping;
use Psr\Http\Message\ResponseInterface;

#[Controller(prefix: "api/cms/category")]
class CategoryController extends ApiController
{
    #[Inject]
    protected CategoryService $service;

    #[GetMapping("getByCode")]
    public function getByCode(): ResponseInterface
    {
        return $this->success($this->service->getByCode($this->request->input('code')));
    }

    #[GetMapping("tree")]
    public function tree(): ResponseInterface
    {
        return $this->success($this->service->tree($this->request->input('code')));
    }
}